<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html><html lang="en">
	<head>
		<!--加载header文件-->
		<?php
		include_once 'public/views/header.php';
		include_once 'public/home/html/ueditor.php';
		include_once 'public/home/html/laydate.php';
		?>
		<?php
		include_once 'public/home/html/faltSelect.php';
		?>
		<link rel="stylesheet" href="public/css/edit.css" />
		<script src="cust/js/announcementEdit.js"></script>
		<script src="public/js/cus_modal.js"></script>
		<style>
			body{
				overflow-x: hidden;
			}
			.required{
				min-width:80px;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<div class="row">
				<input type="hidden" id="modal_title" value="<?=$title ?>" />
				<input type="hidden" id="modal_height" value="450" />
				<form id="editForm">
					<input type="hidden" id="id" name="id" value="<?=estr($detail, 'id') ?>" />
					<table class='edit_table'>
						<tr>
							<th class="required">标题</th>
							<td colspan="3">
								<input type="text" name="title" id="title" value="<?=estr($detail, 'title') ?>" dataType="*" />
							</td>
						</tr>
						<tr>
							<th class="required">公示时间</th>
							<td colspan="3">
								<input type="text" name="start" id="start" value="<?=estr($detail, 'start')?date('Y-m-d',estr($detail, 'start')):estr($detail, 'start') ?>" dataType="*" />
								&nbsp;
								至
								&nbsp;
								<input type="text" name="end" id="end" value="<?=estr($detail, 'end')?date('Y-m-d',estr($detail, 'end')):estr($detail, 'end') ?>" dataType="*" />
							</td>
						</tr>
						<tr>
							
							<th class="required">发送对象</th>
							<td colspan="3" class="sub-role-td">
								<div id="sub_role_div"></div>
							</td>
						</tr>
						<tr>
							<th class="required">内容</th>
							<td colspan="3">
								<script id="editor" type="text/plain" style="width:600px;height:250px;"></script>
								<textarea name="content" id="content" cols="30" rows="10" style="width:100%; display: none;"><?php echo $detail['content']; ?></textarea>
							</td>
						</tr>
						
					</table>
				</form>
				<div class="viewContent">
					<!--这是显示具体车辆信息情况的。-->
				</div>
			</div>
		</div>
	</body>

	<script type="text/javascript">
		<?php 
			$tagData=array();
			$defaultData=array();
			$have_sub_role_id=explode(',',$detail['role_id_str']);
			foreach ($role as $k => $v) {
				if(in_array($v['id'],$have_sub_role_id)){					
					$defaultData[]=array('name'=>$v['name'],'id'=>$v['id']);
				}else{
					$tagData[]=array('name'=>$v['name'],'id'=>$v['id']);
				}	
			}
		?>
	
		var tagData =<?php echo json_encode($tagData) ?>;
		var defaultData = <?php echo json_encode($defaultData) ?>;
	    //input name 为 fileIds
	    $.myMethod("#sub_role_div",tagData,"role_id_str[]",defaultData);
	    $(".sumbit").on("click",function(){
	    	console.log($("form").serialize())
	    })


</script>
</html>
